|
![](/i/fill.gif) |
Christoph Hormann wrote:
> Wolfgang Wieser wrote:
>> [...]
>>
>> I consider the introduction of these two classes as good design.
>
> Speaking of good design:
>
> static inline void PRT_interpolate_linear(COLOUR *dest,
> COLOUR *l,COLOUR *r,float p)
> {
> for(unsigned int ii=0; ii<sizeof(COLOUR)/sizeof(float); ii++)
> { (*dest)[ii]=PRT_interpolate_linear((*l)[ii],(*r)[ii],p); }
> }
>
> For constructions like this you deserve to get shot.
>
(1) This does not come from one of the two classes.
I explicitly put the functions doing the dirty things as
some inline functions at the beginning of the file.
(pure C guys would use macros here...)
(2) These functions are actually older than the PRT patch.
They go back to my IPT patch.
(3) What would you suggest as the "best" solution?
I'll be happy to replace it.
Wolfgang
BTW, I like these much much better:
#define Assign_Colour_Express(d,s) {(d)[pRED] = (s)[pRED]; (d)[pGREEN] = \
(s)[pGREEN]; (d)[pBLUE] = (s)[pBLUE]; (d)[pFILTER] = (s)[
#define Make_Colour(c,r,g,b) {(c)[pRED]=(r);(c)[pGREEN]=(g);\
(c)[pBLUE]=(b);(c)[pFILTER]=0.0;(c)[pTRANSM]=0.0;}
#define Make_ColourA(c,r,g,b,a,t) {(c)[pRED]=(r);(c)[pGREEN]=(g); \
(c)[pBLUE]=(b);(c)[pFILTER]=(a);(c)[pTRANSM]=t;}
#define Make_Vector(v,a,b,c) { (v)[X]=(a);(v)[Y]=(b);(v)[Z]=(c); }
#define Make_UV_Vector(v,a,b) { (v)[U]=(a);(v)[V]=(b); }
#define Destroy_Colour(x) if ((x)!=NULL) POV_FREE(x)
#define Make_RGB(c,r,g,b) {(c)[pRED]=(r);(c)[pGREEN]=(g);(c)[pBLUE]=(b);}
What about shooting the author(s) with a machine gun? :p
Post a reply to this message
|
![](/i/fill.gif) |